if(!MOVIC)
{
	var MOVIC={};
}
MOVIC.grid = new Class({
	div_container:null,
	header:[],
	datos:{},
	_row_class:null,
	initialize: function(id){
        this.div_container = $(id);
    },
	__data_array:function(contenedor,header,data){
	
	},
	render: function()
	{
		this.div_container.empty();
		if(!this.div_container.hasClass('t_table'))
		{
			this.div_container.addClass('t_table')
		}
		var datos = this.datos;
		var header = this.header;
		var row_class= this._row_class;
		if(typeOf(header) == 'object')
		{
			header = Array.from(header);
		}
		var contenedor = this.div_container;
		var sw = 1;
		var tr_header = new Element('div',{'class':'t_header'});
		contenedor.empty();
		Array.each(header,function(item,id){
			if(item)
			{
				tr_header.adopt(new Element('div',{text:item}));
			}
		});
		contenedor.adopt(tr_header);
		
		Array.each(datos,function(data,i){
			var tr = new Element('div',{class:"t_row",
										tabindex:1});
			if(row_class){
				tr.addClass(row_class);
			}
			Array.each(header,function(item,id){
				if(item)
				{
					tr.adopt(new Element('div',{text:data[id]}));
				}
			});
			if(sw == 2){
				tr.addClass('row-1');
				sw =1;	
			}
			else
			{
				tr.addClass('row-2');
				sw++;
			}
			tr.setProperty("data-id",i);
			contenedor.adopt(tr);
		});
	},
	setHeader:function(header_array)
	{
		this.header = header_array;
	},
	setData:function(datos_object)
	{
		this.datos = datos_object;
	},
	getId:function(row)
	{
		if (this.datos[row])
		{
			if(this.datos[row][0])
			{
				return this.datos[row][0];
			}
			if(this.datos[row]['id'])
			{
				this.datos[row]['id'];
			}
		}
		return false;
	},
	getData:function(row)
	{
		if (this.datos[row])
		{
			return this.datos[row];
		}
		return false;
	},
	setRowClass:function(clase)
	{
		this._row_class = clase;
	}
	
});